package com.tjetc.controller;

import com.tjetc.domain.Close;
import com.tjetc.service.CloseService;
import com.tjetc.vo.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * (close)表控制层
 *
 * @author xxxxx
 */
@RestController
@RequestMapping("/close")
public class CloseController {
    /**
     * 服务对象
     */
    @Resource
    private CloseService closeService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public Close selectOne(Integer id) {
        return closeService.selectByPrimaryKey(id);
    }

    @RequestMapping("findAll")
    public List<Close> findAll() {
        return closeService.findAll();
    }

    @RequestMapping("getById")
    public Result getById(
            @RequestParam("id") Integer id
    ) {
        return closeService.getById(id);
    }

    @RequestMapping("list")
    public Result list() {
        return closeService.list();
    }

    @RequestMapping("add")
    public Result add(@RequestBody Close close){
        return closeService.addClose(close);
    }
}
